﻿package com.unifiedfield
{
// 2008-04-16  jgs Adding in Signal Stations
// 2008-06-10  jm  Rewrite as true Class
// 2008-06-18  jgs Ad and revise for signal stations
// 2008-06-20  jgs Add Signal_GetLastSavedScanImage
// 2008-07-01  jgs Add Signal_GetLastSavedAlteredImage
// 2008-07-09  jgs Add Surgery_GetForce & Surgery_GetStatus
// 2008-07-15  jgs Add LogIn_AudioFileReady()
// 2008-07-17  jgs Add LogIn_GetTempAudioSampleFilePath
// 2008-07-18  jgs Add commands for Animation (Motion Builder)
// 2008-07-23  jgs Add commands for database - Login,
// 2008-07-26  jgs @ home more database
// 2008-07-27  jgs Add LogIn_StartLights()
// 2008-07-28  jgs Add Signal_StartLights()
// 2008-07-29  jgs Add messaging
// 2008-08-05  jgs Add AlwaysCheckFelica
// 2008-08-06  jgs Finish messaging Add - Signal_GetThisSignalStationNumber() 
//                     Signal_CheckForMessage() & Signal_SendMessage()
// 2008_08_07  jgs Added Signal_SendMessageToDisplay()
// 2008_08_13  jgs Added Animation_StartCharacterSection()
// 								 Added Animation_CharacterLoading()
//								 Added Animation_Reset()
//								 Revised Animation_MoveCharacter()
// 2008_08_14  jgs Removed: Animation_LoadFile(), Animation_LoadVariables(), Animation_SelectCharacter
//								 Revised: Animation_MoveCharacter()
//								 Added: Animation_SetCamera(), Animation_Rotate, Animation_SetKeyframe()
//                    Animation_Playback(), Animation_RenderFile()
// 2008_08_15  jgs Added: Animation_CheckRender()
// 2008_08_22  jgs Added: Animation_StopRefresh() & Animation_StartRefresh()
// 2008_08_29  jgs Added: Animation_StartEnvironmentSection()
// 2008-09-04  jgs Added: Animation_EnvironmentSelectObject(), Animation_EnvironmentRotateCameraView(), Animation_EnvironmentScaleObject(),
//										Animation_EnvironmentRotateObject(), Animation_EnvironmentTranslateObject(), Animation_EnvironmentSelectLightEffect(),
//                    Animation_EnvironmentSelectVisualEffect()
// 2008-09-14  jgs Adding and revising Animation - Environment commands
// 2008-09-15  jgs Changed Animation_ShowVisualEffect() to take 2 parameters
// 2008-09-18  jgs Added: Signal_PutStamp(), Signal_CheckStampDone(), Signal_CancelStamp()
// 2008_09-19  jgs Added: AnimationStartCustomCharacter(), Animation_CharacterLoading(), Animation_CustomCharacterBuild()
//										Animation_CustomMoveCharacter(), Animation_CustomSetCharacter(), Animation_CustomRotate(), 
//										Animation_CustomSetKeyframe(), Animation_CustomPlayback()
// 2008_09_22  jgs Added: Animation_CharacterResetSliders(),Animation_CustomResetSliders(), 
//										Animation_CustomResetPostureSliders(), Animation_EnvironmentResetSliders()
//								
	
	// Import needed for Host Interface
	import flash.external.ExternalInterface;
	import flash.xml.XMLDocument;
	import flash.utils.*;  // For Interval & Timer functions
	import flash.events.KeyboardEvent;  // For events
	import flash.display.*;


public class cHoster
{
	//  Variables for Host Interface
	private  var sCardId:String="";
  	private  var hHostStartupTimer:Timer;
	private  var bHostReady=false;

	public function cHoster ()  
	{
		init();
	}
	/**********************************
	*
	*  Init()
	*
	*  Initialize the application 
	*
	***********************************/
	//public  function Init()
	private function init()
		{
		trace( "Start init.");			
		// if ExternalInterface isn't available, there's nothing to do
		// so just note it and leave.
		if( !ExternalInterface.available ) 
			{
			trace( "External Interface *not* avaiable!" );
			return;
			}
		
		bHostReady=false;
		
		StartCommunicationEventHandlers();
		
//    CatchKeys.StartCatch();
		
		trace( "External Interface avaiable!" );
			
		} // End Init()
		
	/**********************************
	*
	*  StartCommunicationEventHandlers()
	*
	*  Start the hooks that will receive messages from host. 
	*
	***********************************/
	private  function StartCommunicationEventHandlers()
		{
			
		// expose a method "SetEnabled" to the Host
		ExternalInterface.addCallback( "SetEnabled" , SetEnabled );
					
		trace("SetEnabled");
		
		}	// End StartCommunicationEventHandlers()
	
	/**********************************
	*
	*  SetEnabled()
	*
	* 	Enable / disable the interface based on if the window
	* 	that the Flash Movie is hosted in has focus.  This
	* 	is a method that gets invoked directly from C#, and is
	* 	able to be invoked because of the ExternalInterface 
	*   addCallback in wireEventHandlers().
	*
	***********************************/
	private  function SetEnabled( enabled:String )
		{
		// enabled is a string coming from the C# program.  If enabled
		// is the string "true" then we'll set the buttons to be
		// enabled, otherwise disable the interface
	//	sweepstakes_btn.enabled = contact_btn.enabled = links_btn.enabled = ( enabled == "true" ) ? true : false;
		
		// Just for kicks, we'll return a value to the C# program - this
		// is just for demonstration purposes.
		
		bHostReady=false;
		
		trace("Enabled");
		
		return (1);
		} // End SetEnabled()
	
	/**********************************
	*
	*  convertXMLStringToObject()
	*
	* 	Responses from the host come in as XML strings
	*     (such as "<root><node label='test' /></root>")
	*     and need to be converted to XML Objects.
	*
	***********************************/
	
	public  function convertXMLStringToObject( str:String ):XMLDocument 
		{
		var xml:XMLDocument = new XMLDocument();
		var filesXmlString:String = str;
		xml.ignoreWhite = true;
		xml.parseXML( filesXmlString );
		return xml;
		} // End convertXMLStringToObject()
	
	
	/**********************************
	*
	*  OutToTrace()
	*
	* 	For testing, just sends given string out to trace.
	*
	***********************************/
	public  function OutToTrace(sMessage:String)
		{
		
		trace( sMessage );
	
		return;
		
		} // OutToTrace()

	/**********************************
	*
	*  ShowAlert()
	*
	* 	We ask the host to display a message box with our message.
	*
	***********************************/
	public  function ShowAlert(sMessage:String)
		{
		
		ExternalInterface.call( "OpenMessageBox" , sMessage );
	
		return;
		
		} // ShowAlert()
	
	/**********************************
	*
	*  AddToLog()
	*
	* 	We ask the host to add an entry to the FLASH log file.
	*   This will only do something of the FLASH log file setting
	*      exists in .INI file of the host application.
	*
	***********************************/
	public  function AddToLog(sMessage:String)
		{
			
		trace( sMessage );
		
		ExternalInterface.call( "AddToLog" , sMessage );
	
		return;
		
		} // AddToLog()
		
	/**********************************
	*
	*  GetConfigurationSetting()
	*
	* 	We ask the host to add an entry to the FLASH log file.
	*   This will only do something of the FLASH log file setting
	*      exists in .INI file of the host application.
	*
	***********************************/
	public  function GetConfigurationSetting(sSection:String, sKey:String):String
		{

		var sSetting:String;

		sSetting = String( ExternalInterface.call( "GetConfig" , "Bob" ));
	
		trace( "Get Config" );
	
		return(sSetting);
		
		} // GetConfigurationSetting()
		
	/**********************************
	*
	*  GetDiskSpace()
	*
	* 	We ask the host for the time.
	*
	***********************************/
	public  function GetDiskSpace():String 
		{
			
		var sSpace:String;
		
		// Note the synchronous communication here - we make a call to the C# container, and get
		// a String response back.  Then, we convert that string response to an XML object and
		// use it as a dataProvider for the tree.
//		sSpace = String( ExternalInterface.call( "GetDiskSpace" , "C" ) );
	
		sSpace = String( ExternalInterface.call( "GetDiskSpace" , "Primero", "Second" ));
	
		return(sSpace);
		
		} // GetDiskSpace()
		
	/**********************************
	*
	*  GetTime()
	*
	* 	We ask the host for the time.
	*
	***********************************/
	public  function GetTime():String 
		{
			
		var sTime:String;
		
		// Note the synchronous communication here - we make a call to the C# container, and get
		// a String response back.  Then, we convert that string response to an XML object and
		// use it as a dataProvider for the tree.
		sTime = String( ExternalInterface.call( "GetTime" , "C" ) );
	
		return(sTime);
		
		} // GetTime()
		
	/**********************************
	*
	*  SendKey()
	*
	* 	Sends a key
	*
	***********************************/
	public  function  SendKey( szKey:String ) 
		{
		
		String( ExternalInterface.call( "KeyHit" , szKey ) );
		
		} //  SendKey()					
		
	/**********************************
	*
	*  GetSelfTest()
	*
	* 	Determines if .ini is set for us to do self test
	*
	*   Returns:  "1" Do self test
	*             "0" No self test
	*
	***********************************/
	public  function  GetSelfTest(): String
		{
			
    var sDoSelfTest:String;		
		
		sDoSelfTest = String( ExternalInterface.call( "DoSelfTest" , "C" ) );
		
		return( sDoSelfTest );
		
		} //  GetSelfTest()					
		
	/**********************************
	*
	*  DoTimeout()
	*
	* 	Determines if we allow timeouts to occurr
	*
	*   Returns:  "1" Do Timeouts
	*             "0" No Timeouts
	*
	***********************************/
	public  function  DoTimeout(): String
		{
			
    var sTimeout:String;		
		
		sTimeout = String( ExternalInterface.call( "DoTimeout" , "C" ) );
		
		return( sTimeout );
		
		} //  DoShowCursor()					

	/**********************************
	*
	*  GetTimeoutSeconds()
	*
	* 	Gets the timeout time as STRING in seconds
	*   If Time Out Time = 0 then no time outs	*
	*
	***********************************/
	public  function  GetTimeoutSeconds(): String
		{
			
    var sTimeoutSeconds:String;		
		
		sTimeoutSeconds = String( ExternalInterface.call( "GetTimeoutSeconds" , "C" ) );
		
		return( sTimeoutSeconds );
		
		} //  GetTimeoutSeconds()					
		
	/**********************************
	*
	*  DoShowCursor()
	*
	* 	Determines if we show cursor
	*
	*   Returns:  "1" Show Cursor
	*             "0" Hide Cursor
	*
	***********************************/
	public  function  DoShowCursor(): String
		{
			
    var sShowCursor:String;		
		
		sShowCursor = String( ExternalInterface.call( "DoSelfTest" , "C" ) );
		
		return( sShowCursor );
		
		} //  DoShowCursor()					

	/**********************************
	*
	*  DoStartOnTouch()
	*
	* 	Determines if a touch to start things
	*
	*   Returns:  "1" Allow touch to start
	*             "0" Only Felica will start
	*
	***********************************/
	public  function  DoStartOnTouch(): String
		{
			
    var sTouchStart:String;		
		
		sTouchStart = String( ExternalInterface.call( "StartOnTouch" , "C" ) );
		
		return( sTouchStart );
		
		} //  DoStartOnTouch()					

	/**********************************
	*
	*  GetStationNumber()
	*
	* 	Returns the station number as a string
	*
	*   Returns:  String - Station number
	*
	***********************************/
	public  function  GetStationNumber(): String
		{
			
    var sStationNumber:String;		
		
		sStationNumber = String( ExternalInterface.call( "GetStationNumber" , "C" ) );
		
		return( sStationNumber );
		
		} //  GetStationNumber()					
		
	/**********************************
	*
	*  AudioOn()
	*
	* 	Play or Silence Audio
	*
	*   Returns:  "1" Play Audio
	*             "0" Don't Play Audio
	*
	***********************************/
	public  function  AudioOn(): String
		{
			
    var sAudio:String;		
		
		sAudio = String( ExternalInterface.call( "AudioOn" , "C" ) );
		
		return( sAudio );
		
		} //  DoStartOnTouch()					
		
	/**********************************
	*
	*  AlwaysCheckFelica()
	*
	* 	Determines if Felica should be constantly checked while running.
	*
	*   Returns:  "1" Always check Felica
	*             "0" Only check Felica durring attract.
	*
	***********************************/
	public  function  AlwaysCheckFelica(): String
		{
			
    var sCheck:String;		
		
		sCheck = String( ExternalInterface.call( "AlwaysCheckFelica" , "C" ) );
		
		return( sCheck );
		
		} //  AlwaysCheckFelica()					
		
		
	//
	// DATA - ALL MODULES
	//

 /**********************************
	*
	*  GetGuestId()
	*
	* 	Returns the database "ID" of the currently logged in Guest
	*
	*   Returns:  String Name
	*
	***********************************/
	public  function  GetGuestId(): String
		{
			
    var sGuestId:String;		
		
		sGuestId = String( ExternalInterface.call( "GetGuestId" , "C" ) );
		
		return( sGuestId );
		
		} //  GetGuestId()			
		
 /**********************************
	*
	*  GetGuestInfo()
	*
	* 	Returns comma delimited string holding Name, Color (RGB) and path to Icon
	*
	*		Uses the Database ID of the currently logged in guest.
	*
	*   Returns:  String Comma delimited list
	*								Name,Color,Path
	*
	***********************************/
	public  function  GetGuestInfo(): String
		{
			
    var sGuestInfo:String;		
		
		sGuestInfo = String( ExternalInterface.call( "GetGuestInfo" , "C" ) );
		
		return( sGuestInfo );
		
		} //  GetGuestInfo()					
	
 /**********************************
	*
	*  GetGuestName()
	*
	* 	Returns the "Name" of the currently logged in user
	*
	*   Returns:  String Name
	*
	***********************************/
	public  function  GetGuestName(): String
		{
			
    var sGuestName:String;		
		
		sGuestName = String( ExternalInterface.call( "GetGuestName" , "C" ) );
		
		return( sGuestName );
		
		} //  GetGuestName()					

 /**********************************
	*
	*  GetGuestMusic()
	*
	* 	Returns the "Music Choice" of the currently logged in user
	*
	*   Returns:  String 1-6 
  *             "-1" if errors
	*
	***********************************/
	public  function  GetGuestMusic(): String
		{
			
    var sMusic:String;		
		
		sMusic = String( ExternalInterface.call( "GetGuestMusic" , "C" ) );
		
		return( sMusic );
		
		} //  GetGuestMusic()					

 /**********************************
	*
	*  StationActivateGuest()
	*
	* 	Activates the Guest with the given Felica ID as the current user of this station.
	*    This station is now marked as "visited" by this guest
	*		 Guest ID is taken from Felica data when they logged in.
	*		 Station name and number are loaded in by host at startup form the .ini file.
	*  
	*   Returns String:
	*			"-1" If error occurred
	*			"0" If this Felica is not logged in (i.e. they have not done "Log In")  In this
  *						case they should be told to log in and the activity should restart.
	*					Database ID # for this guest.
	*
	***********************************/
	public  function  StationActivateGuest( sFelicaId:String): String
		{
			
    var sDbId:String;		
		
		sDbId = String( ExternalInterface.call( "StationActivateGuest" , sFelicaId ) );
		
		return( sDbId );
		
		} //  StationActivateGuest()					
		
		//
		// FELICA
		//
	/**********************************
	*
	*  FelicaGetLastError()
	*
	* 	Retrives a string that describes the last Felica Error that occurred.
	*
	***********************************/
	public  function FelicaGetLastError():String 
		{
		
		var sError:String;
		
		sError = String( ExternalInterface.call( "Felica_GetLastError" , "C" ) );
	
		return(sError);
		
		} // FelicaGetLastError()
		
	/**********************************
	*
	*  FelicaOpen()
	*
	* 	Connect to the Felica Reader.
	*
	***********************************/
	public  function FelicaOpen():String 
		{
	
		var sResult:String;
	
		sResult = String( ExternalInterface.call( "Felica_Open" , "C" ) );
	
		return(sResult);
		
		} // FelicaOpen()
	
	/**********************************
	*
	*  FelicaClose()
	*
	* 	Close connection to Felica reader.
	*
	***********************************/
	public  function FelicaClose():String 
		{
		
		var sResult:String;
		
		sResult = String( ExternalInterface.call( "Felica_Close" , "C" ) );
	
		return(sResult);
		
		} // FelicaClose()
	
	/**********************************
	*
	*  FelicaStartPolling()
	*
	* 	We ask the host for the available disk space.
	*
	***********************************/
	public  function FelicaStartPolling():String 
		{
		
		var sResult:String;
		var hFelicaPollingTimer:Timer	
		var sId:String;
		
		sResult = String( ExternalInterface.call( "Felica_StartPolling" , "C" ) );
		
		return(sResult);
		
		} // FelicaStartPolling()
		
	/**********************************
	*
	*  FelicaStopPolling()
	*
	* 	We ask the host for the available disk space.
	*
	***********************************/
	public  function FelicaStopPolling():String 
		{
		
		var sResult:String;
		
		//killTimer(intervalId);
		
		sResult = String( ExternalInterface.call( "Felica_StopPolling" , "C" ) );
	
		return(sResult);
		
		} // FelicaStopPolling()
		
	/**********************************
	*
	*  FelicaCheckForCard()
	*
	* 	We check host to see if a card has been seen since the last
	*        time we asked.
	*   If card was seen we card back the "ID" of the card.
	*     Otherwise we get "0".
	*
	***********************************/
	public  function FelicaCheckForCard():String 
		{
		
		var sId:String;
		
		sId = String( ExternalInterface.call( "Felica_CheckForCard" , "C" ) );
		
		if( sId != "0" )
			{
			sCardId=sId;
			}
				
		return(sId);
		
		} // FelicaCheckForCard()
		
	/**********************************
	*
	*  FelicaGetCurrentUserId()
	*
	* 	Returns the last User ID captured form a guest's card.
	*
	***********************************/
	public  function FelicaGetCurrentUserId():String 
		{
		
		return( sCardId );
		
		} // FelicaGetCurrentUserId()
		
 /**********************************
	*
	*  LogIn_GetCurrentGuests()
	*
	* 	Delivers a comma delimited list of users and colors:
	*        John,6,Bob,5
	*
	*        iCount:Number # of name. color sets to return
	*
	***********************************/
	public  function  LogIn_GetCurrentGuests( iCount:Number ):String
		{
			
		var sGuests:String
			
		sGuests = String( ExternalInterface.call( "LogIn_GetCurrentGuests" , iCount ) );
		
		return( sGuests );
		
		} //  LogIn_GetCurrentGuests()					

 /**********************************
	*
	*  LogIn_CreateNewGuest()
	*
	* 	At log in station, creates a new Guest Account
	*     based on the Felica ID
	*
	*		Returns User ID.
	*
	***********************************/
	public  function  LogIn_CreateNewGuest( sFelicaId:String ): String
		{
			
		var sGuestId:String
			
		sGuestId = String( ExternalInterface.call( "LogIn_CreateNewGuest" , sFelicaId ) );
		
		return( sGuestId );
		
		} //  LogIn_CreateNewGuest()					

	/**********************************
	*
	*  LogIn_CameraConnect()
	*
	* 	Connects to the Digital Camera
	*
	***********************************/
	public  function LogIn_CameraConnect() 
		{
		
		var sResult:String;
		
		String( ExternalInterface.call( "LogIn_CameraConnect" , "C" ) );
		
		} // LogIn_CameraConnect()		
		
	/**********************************
	*
	*  LogIn_CameraDisconnect()
	*
	* 	Disconnects from the Digital Camera
	*
	***********************************/
	public  function LogIn_CameraDisconnect() 
		{
		
		String( ExternalInterface.call( "LogIn_CameraDisconnect" , "C" ) );
		
		} // LogIn_CameraDisconnect()		

	/**********************************
	*
	*  LogIn_CameraShow()
	*
	* 	Shows the viewfinder on the Digital Camera
	*
	***********************************/
	public  function LogIn_CameraShow() 
		{
		
		String( ExternalInterface.call( "LogIn_CameraShow" , "C" ) );
		
		} // LogIn_CameraShow()		
		
	/**********************************
	*
	*  LogIn_CameraHide()
	*
	* 	Hides the viewfinder on the Digital Camera
	*
	***********************************/
	public  function LogIn_CameraHide() 
		{
		
		String( ExternalInterface.call( "LogIn_CameraHide" , "C" ) );
		
		} // LogIn_CameraHide()		
		
	/**********************************
	*
	*  LogIn_CameraTakePicture()
	*
	* 	Takes the picture and saves it as a cropped temp file.
	*
	*   int iVersion  If 1 then Picture 1
	*                 If 2 then picture 2
	*
	***********************************/
	public  function LogIn_CameraTakePicture( iVersion:int  ) 
		{
			
		if( iVersion == 1 )
		  {
		  String( ExternalInterface.call( "LogIn_CameraTakePicture_1" , "C" ) );
			}
		else
		  {
		  String( ExternalInterface.call( "LogIn_CameraTakePicture_2" , "C" ) );
			}
		
		} // LogIn_CameraTakePicture()		
				
	/**********************************
	*
	*  LogIn_CameraSavePicture()
	*
	* 	Saves the picture with the system defined filename.
	*
	*   int iVersion  If 1 then Picture 1
	*                 If 2 then picture 2
	*
	***********************************/
	public  function LogIn_CameraSavePicture( iVersion:int ) 
		{
		
		if( iVersion == 1 )
		  {
		  String( ExternalInterface.call( "LogIn_CameraSavePicture_1" , "C" ) );
			}
		else
		  {
		  String( ExternalInterface.call( "LogIn_CameraSavePicture_2" , "C" ) );
			}

		} // LogIn_CameraSavePicture()		
				
	/**********************************
	*
	*  LogIn_CameraPictureReady()
	*
	* 	Returns true if the specified picture is ready.
	*
	*   int iVersion  If 1 then Picture 1
	*                 If 2 then picture 2
	*
	***********************************/
	public  function LogIn_CameraPictureReady( iVersion:int ):Boolean 
		{
		
		var sReady:String;
		
		if( iVersion == 1 )
		  {
		  sReady = String( ExternalInterface.call( "LogIn_CameraPictureReady_1" , "C" ) );
			}
		else
		  {
		  sReady = String( ExternalInterface.call( "LogIn_CameraPictureReady_2" , "C" ) );
			}
		
		if( sReady == "0" )
			{
			return( false );
			}
		else
			{
			return( true );
			}
		
		} // LogIn_CameraPictureReady()		
				
	/**********************************
	*
	*  LogIn_CameraGetPicturePath()
	*
	* 	Returns path to the give temp picture.
	*
	*   int iVersion  If 1 then Picture 1
	*                 If 2 then picture 2
	*
	***********************************/
	public  function LogIn_CameraGetPicturePath( iVersion:int ):String
		{
		
		var sPath:String;

		
		if( iVersion == 1 )
		  {
		sPath = String( ExternalInterface.call( "LogIn_CameraGetTempPicturePath_1" , "C" ) );
			}
		else
		{
		sPath = String( ExternalInterface.call( "LogIn_CameraGetTempPicturePath_2" , "C" ) );
		}
		
		return( sPath );		
		
		} // LogIn_CameraGetPicturePath()		
				
	/**********************************
	*
	*  LogIn_CameraHidePicture()
	*
	* 	Hides the last picture taken.
	*
	***********************************/
	public  function LogIn_CameraHidePicture() 
		{
		
		String( ExternalInterface.call( "LogIn_CameraHidePicture" , "C" ) );
		
		} // LogIn_CameraHidePicture()		
		
 /**********************************
	*
	*  LogIn_SetGuestName()
	*
	* 	The guest has entered a name at the kiosk, we
	*     add that name to the database associating it
	*     with the current logged in guest.
	*
	*		String: sName  The guest's name
	*
	*   Return: sCanUseName:String "1" = valid name
	*                              "0" = Name failed vetting (is "dirty")
	*
	***********************************/
	public  function  LogIn_SetGuestName( sName:String ): String
		{
			
		var sCanUseName:String
			
		sCanUseName = String( ExternalInterface.call( "LogIn_SetGuestName" , sName ) );
		
		return( sCanUseName );
		
		} //  LogIn_SetGuestName()					

 /**********************************
	*
	*  LogIn_SetGuestColor()
	*
	* 	The guest has selected a color at the kiosk, we
	*     add that color (0-17) to the database associating it
	*     with the current logged in guest.
	*
	*		Number: iColor  The guest's color (0-17)
	*
	***********************************/
	public  function  LogIn_SetGuestColor( iColor:Number ):void
		{
			
		String( ExternalInterface.call( "LogIn_SetGuestColor" , iColor ) );
		
		return;
		
		} //  LogIn_SetGuestColor()					

 /**********************************
	*
	*  LogIn_SetGuestMusic()
	*
	* 	The guest has made a music selection at the kiosk, we
	*     add that music (1-5) to the database associating it
	*     with the current logged in guest.
	*
	*		Number: iMusic  The guest's music (1-5)
	*
	***********************************/
	public  function  LogIn_SetGuestMusic( iMusic:Number ):void
		{
			
		String( ExternalInterface.call( "LogIn_SetGuestMusic" , iMusic ) );
		
		return;
		
		} //  LogIn_SetGuestMusic()					

 /**********************************
	*
	*  LogIn_AudioReset()
	*
	* 	Restarts the audio interface (call before each use)
	*
	***********************************/
	public  function  LogIn_AudioReset()
		{
			
		String( ExternalInterface.call( "LogIn_AudioReset" , "C" ) );
		
		return;
		
		} //  LogIn_AudioReset()					

 /**********************************
	*
	*  LogIn_StartAudioRecording()
	*
	* 	Starts the recording in LogIn
	*
	***********************************/
	public function LogIn_StartAudioRecording()  //JRM removed 
		{
			
		String( ExternalInterface.call( "LogIn_StartAudioRecording" , "C" ) );
		
		return;
		
		} //  LogIn_StartAudioRecording()					

 /**********************************
	*
	*  LogIn_GetNextAudioValue()
	*
	* 	Returns audio value from recording so Flash can plot it.
	*
	*   RETURN:
	*				String of comma seperated values or "0,o" if nothing
	*
	***********************************/
	public  function  LogIn_GetNextAudioValue(): String
		{
			
		var sAudValue:String;
			
		sAudValue = String( ExternalInterface.call( "LogIn_GetNextAudioValue" , "C" ) );
		
		return( sAudValue );
		
		} //  LogIn_GetNextAudioValue()					

 /**********************************
	*
	*  LogIn_StopAudioRecording()
	*
	* 	Stops the recording in LogIn
	*
	***********************************/
	public  function  LogIn_StopAudioRecording()
		{
			
		String( ExternalInterface.call( "LogIn_StopAudioRecording" , "C" ) );
		
		return;
		
		} //  LogIn_StopAudioRecording()				
		
 /**********************************
	*
	*  LogIn_AudioFileReady()
	*
	* 	Checks to see if MP3 file conversion has completed
	*
	*		Returns:
	*			"-1" Error
	*			"0"  Not Ready
	*     "1"  Ready
	*
	***********************************/
	public function	LogIn_AudioFileReady()
		{
			
		var sReadyValue:String;
			
		sReadyValue = String( ExternalInterface.call( "LogIn_AudioFileReady" , "C" ) );
		
		return( sReadyValue );
			
		} // LogIn_AudioFileReady()

 /**********************************
	*
	*  LogIn_CopyFiles()
	*
	* 	Guest has selected their final recoding.
	*   This will copy the temp files to their final form on the server.
	*       Files are the Wave file and the Text file withe the sample values.
	*
	***********************************/
	public  function  LogIn_CopyFiles()
		{
			
		String( ExternalInterface.call( "LogIn_CopyFiles" , "C" ) );
		
		return;
		
		} //  LogIn_CopyFiles()					

 /**********************************
	*
	*  LogIn_GetTempAudioFilePath()
	*
	* 	Returns the path to the temporary wave file that has just been recorded
	*
	*   RETURN:
	*				String of full path and filename
	*
	***********************************/
	public  function  LogIn_GetTempAudioFilePath(): String
		{
			
		var sPath:String;
			
		sPath = String( ExternalInterface.call( "LogIn_GetTempAudioFilePath" , "C" ) );
		
		return( sPath );
		
		} //  LogIn_GetTempAudioFilePath()		
		
 /**********************************
	*
	*  LogIn_GetTempAudioFilePath()
	*
	* 	Returns the path to the temporary audio sample file that has just been recorded
	*
	*   RETURN:
	*				String of full path and filename
	*
	***********************************/
	public  function  LogIn_GetTempAudioSampleFilePath(): String
		{
			
		var sPath:String;
			
		sPath = String( ExternalInterface.call( "LogIn_GetTempAudioSampleFilePath" , "C" ) );
		
		return( sPath );
		
		} //  LogIn_GetTempAudioSampleFilePath()

		
 /**********************************
	*
	*  LogIn_StartLights()
	*
	* 	Starts the light pattern from this login station
	*
  *   sColorInHex:String  
  *       Player's selected color as a HEX string.
  *
	*   RETURN:
	*				
	***********************************/
	public  function  LogIn_StartLights( sColorInHex:String )
		{
			
		String( ExternalInterface.call( "LogIn_StartLights" , sColorInHex ) );
		
		return;
		
		} //  LogIn_StartLights()


	/**********************************
	*
	*  Signal_ImageShow()
	*
	* 	Shows the signal station image
	*
	***********************************/
	public  function  Signal_ImageShow() 
		{
		
    String( ExternalInterface.call( "SignalImage_Show" , "C" ) );
		} //  Signal_ImageShow()		
		
	/**********************************
	*
	*  Signal_ImageHide()
	*
	* 	Hides the signal station image
	*
	***********************************/
	public  function  Signal_ImageHide() 
		{
		
		String( ExternalInterface.call( "SignalImage_Hide" , "C" ) );
		
		} //  Signal_ImageHide()		

	/**********************************
	*
	*  Signal_ImageRestart()
	*
	* 	Restarts the Signal Station Image Interface
	*
	***********************************/
	public  function  Signal_ImageRestart() 
		{
		
		String( ExternalInterface.call( "SignalImage_Restart" , "C" ) );
		
		} //  Signal_ImageRestart()		

	/**********************************
	*
	*  Signal_ImageUndo()
	*
	* 	Performs UNDO restoring image to it's last state.
	*   There is only one UNDO level.
	*   "Stamp" and Color are not affected by UNDO.
	*
	***********************************/
	public  function  Signal_ImageUndo() 
		{
		
		String( ExternalInterface.call( "SignalImage_Undo" , "C" ) );
		
		} //  Signal_ImageUndo()		

 public  var SIGNAL_EFX_INVERT:Number = 1;
 public  var SIGNAL_EFX_GRAY_SCALE:Number = 2;
 public  var SIGNAL_EFX_EMBOSS:Number = 3;
 public  var SIGNAL_EFX_KIRSCH:Number = 4;
 public  var SIGNAL_EFX_FLIP:Number = 5;
 public  var SIGNAL_EFX_SWIRL:Number = 6;
 public  var SIGNAL_EFX_SPHERE:Number = 7;
 public  var SIGNAL_EFX_WARP:Number = 8;
 public  var SIGNAL_EFX_WATER:Number = 9;
 public  var SIGNAL_EFX_PIXELATE:Number = 10;
 public  var SIGNAL_EFX_COLOR:Number = 11;

	/**********************************
	*
	*  Signal_ImageEfx()
	*
	* 	Does the specified Effect
	*
	***********************************/
	public  function  Signal_ImageEfx( iEfx:Number, iParam1:Number, iParam2:Number, iParam3:Number ) 
		{
		
		String( ExternalInterface.call( "SignalImage_Efx" , iEfx, iParam1, iParam2, iParam3 ) );
		
		} //  Signal_ImageEfx()		

	/**********************************
	*
	*  Signal_PutStamp()
	*
	* 	Places the specified stamp
	*		Flash Host will wait for user to touch the image to position the stamp
	*		After calling this FlashHost should be polled by calling Signal_CheckStampDone()
	*			repeatedly to determine when guest has touched and we should move on
	*		If guest touches another button, Stamp, Undo, Efx, Next etc. FlashHost should
	*			be notified that wait for stamp placement has terminated by calling
	*			Signal_CancelStamp() before processing the button.
	*
	*		Parameter:
	*			iStamp:Number  Stamp: 1-4 = Cartoons
	*                           5-8 = Plain shapes
	*						`								9-12 =  Shapes with scan
	*
	***********************************/
	public  function  Signal_PutStamp( iStamp:Number ): void
		{
			
		ExternalInterface.call( "Signal_PutStamp" , iStamp );
		
		} //  Signal_PutStamp()					
				
 /**********************************
	*
	*  Signal_CheckStampDone()
	*
	* 	Checks if the stamp placement is done
	*
	*   Call Repeatedly to determine when the guest is done placing stamp.
	*
	*   Returns:  String "1" if done  "0" if not
	*
	***********************************/
	public  function  Signal_CheckStampDone(): String
		{
			
    var sStampDone:String;		
		
		sStampDone = String( ExternalInterface.call( "Signal_CheckStampDone"  ) );
		
		return( sStampDone );
		
		} //  Signal_CheckStampDone()					

	/**********************************
	*
	*  Signal_CancelStamp()
	*
	* 	Cancels the wait for the user to place his stamp
	*
	***********************************/
	public  function  Signal_CancelStamp() 
		{
		
		ExternalInterface.call( "Signal_CancelStamp" );
		
		} //  Signal_CancelStamp()		

	/**********************************
	*
	*  Signal_ShowLiveScan()
	*
	* 	Displays the live scan window
	*
	***********************************/
	public  function  Signal_ShowLiveScan(): void
		{
			
		ExternalInterface.call( "Signal_ShowLiveScan" , "C" );
		
		} //  Signal_ShowLiveScan()					
				
	/**********************************
	*
	*  Signal_HideLiveScan()
	*
	* 	Hides the live scan window
	*
	***********************************/
	public  function  Signal_HideLiveScan(): void
		{
			
		ExternalInterface.call( "Signal_HideLiveScan" , "C" );
		
		} //  Signal_HideLiveScan()					
		
	/**********************************
	*
	*  Signal_StartScan()
	*
	* 	Starts the scan
	*
	*   Parameter: iVersion:Number  1 OR 2
	*
	***********************************/
	public  function  Signal_StartScan( iVersion:Number ): void
		{
			
		ExternalInterface.call( "Signal_StartScan" , iVersion );
		
		} //  Signal_StartScan()					

	/**********************************
	*
	*  Signal_HideScan()
	*
	* 	Hides the scan window
	*
	***********************************/
	public  function  Signal_HideScan(): void
		{
			
		ExternalInterface.call( "Signal_HideScan" , "C" );
		
		} //  Signal_HideScan()					

 /**********************************
	*
	*  Signal_RestartScan()
	*
	* 	Resets all to start an entirely new scan process
	*
	***********************************/
	public  function  Signal_RestartScan(): void
		{
			
		ExternalInterface.call( "Signal_RestartScan" , "C" );
		
		} //  Signal_RestartScan()					

 /**********************************
	*
	*  Signal_CheckScanDone()
	*
	* 	Checks if the scan is done
	*
	*   Returns:  String "1" if done  "0" if not
	*
	***********************************/
	public  function  Signal_CheckScanDone(): String
		{
			
    var sScanDone:String;		
		
		sScanDone = String( ExternalInterface.call( "Signal_CheckScanDone" , "C" ) );
		
		return( sScanDone );
		
		} //  Signal_CheckScanDone()					

 /**********************************
	*
	*  Signal_GetScanStartCharacter()
	*
	* 	Returns the character that should signal the start of scan.
	*
	*   Returns:  String Character
	*
	***********************************/
	public  function  Signal_GetScanStartCharacter(): String
		{
			
    var sScanStartChar:String;		
		
		sScanStartChar = String( ExternalInterface.call( "Signal_GetScanStartCharacter" , "C" ) );
		
		return( sScanStartChar );
		
		} //  Signal_GetScanStartCharacter()					

 /**********************************
	*
	*  Signal_GetLastSavedScanImage()
	*
	* 	Returns the full path to the specified scan image
	*
	*		Parameters: iVersion:Number  1 OR 2
	*
	*   Returns:  String Path
	*
	***********************************/
	public  function  Signal_GetLastSavedScanImage( iVersion:Number ): String
		{
			
    var sPath:String;		
		
		sPath = String( ExternalInterface.call( "Signal_GetLastSavedScanImage" , iVersion ) );
		
		return( sPath );
		
		} //  Signal_GetLastSavedScanImage()					

 /**********************************
	*
	*  Signal_SelectScan()
	*
	* 	Returns the full path to the specified scan image
	*
	*		Parameters: iVersion:Number  1 OR 2
	*
	***********************************/
	public  function  Signal_SelectScan( iVersion:Number )
		{
			
		ExternalInterface.call( "Signal_SelectScan" , iVersion );
		
		} //  Signal_SelectScan()					

 /**********************************
	*
	*  Signal_ImageLoad()
	*
	* 	Loads the image for signal stations.
	*   This image is the current guest's photo from LogIn.
	*
	***********************************/
	public  function  Signal_ImageLoad() 
		{
		
		String( ExternalInterface.call( "Signal_ImageLoad" , "C" ) );
		
		} //  Signal_ImageLoad()		
		
 /**********************************
	*
	*  Signal_AlteredImageSave()
	*
	* 	Saves the current "Altered" image 
	*
	*     Image name is built based on the user ID and the version number
	*     Image name is saved to the database of the current user.
	*
	*   Parameters:
	*     sId:String  Database ID for the user who "owns" this image
	*     iVersion:Number The sequential version # of this image
	*
	***********************************/
	public  function  Signal_AlteredImageSave( sId:String, iVersion:Number ) 
		{
		
		String( ExternalInterface.call( "Signal_AlteredImageSave" , sId, iVersion ) );
		
		} //  Signal_AlteredImageSave()		

 /**********************************
	*
	*  Signal_GetStationUserId()
	*
	* 	Gets the Database ID of the user at the specified signal station kiosk
	*
	*   int iStation  1 - 7
	*
	*			Station number will be remapped to the station numbers 
	*        loaded from the .ini file.
	*
	*   Returns:
	*			     String sID
	*			     "0" if no user
  *             "-1" if error 
	*
	***********************************/
	public  function Signal_GetStationUserId( iStation:Number ):String
		{
		
		var sId:String;

		sId = String( ExternalInterface.call( "Signal_GetStationUserId" , iStation ) );
		
		return( sId );		
		
		} // Signal_GetStationUserId()		
				
 /**********************************
	*
	*  Signal_AlteredImageLoad()
	*
	* 	Loads the specified "Altered" image 
	*
  *     Details come from "Message" sent from anothe Signal Station.
	*     Image name is built based on the user ID and the version number
	*
	*   Parameters:
	*     sId:String  Database ID for the user who "owns" this image
	*     iVersion:Number The sequential version # of this image
	*			sPath:String  Path that was passed in the message.
  *
  *   Returns:
  *     "1" If success
  *     "0" If failure
	*
	***********************************/
	public  function  Signal_AlteredImageLoad( sId:String, iVersion:Number, sPath:String ): String
		{

     var sRslt:String;
		
		sRslt = String( ExternalInterface.call( "Signal_AlteredImageLoad" , sId, iVersion, sPath ) );

     return( sRslt );
		
		} //  Signal_AlteredImageLoad()		

 /**********************************
	*
	*  Signal_GetAlteredImagePath()
	*
	* 	Returns the full path to the last saved "altered" image
	*     so Flash can display the image
	*
	***********************************/
	public  function  Signal_GetAlteredImagePath():String
		{
			
    var sPath:String;		
		
		sPath = String( ExternalInterface.call( "Signal_GetAlteredImagePath" , "C" ) );
		
		return( sPath );
		
		} //  Signal_GetAlteredImagePath()					

 /**********************************
	*
	*  Signal_GetWaveformPath()
	*
	* 	Returns the full path to the current user's waveform file
	*     so Flash can display the watermark
	*   The wave form is a text file of audio sample values
	*
	***********************************/
	public  function  Signal_GetWaveformPath():String
		{
			
    var sWaveform:String;		
		
		sWaveform = String( ExternalInterface.call( "Signal_GetWaveformPath" , "C" ) );
		
		return( sWaveform );
		
		} //  sWaveform()		
		
 /**********************************
	*
	*  Signal_StartLight()
	*
	* 	Starts the light that runs from a Signal Station message source
	*     to the Signal Stations Destination.
	*
	*     Parameters:
	*				iDest:Number  The destination 1-7 of this message
	*       sColor: String  The current station's "color" as a Hex String
	*
	*			Returns: None
	*
	***********************************/
	public  function  Signal_StartLight( iDest:Number, sColor:String )
		{
			
		String( ExternalInterface.call( "Signal_StartLight" , iDest, sColor ) );
		
		return;
		
		} //  Signal_StartLight()					

/**********************************
 *
 *   Signal_GetThisSignalStationNumber()
 *
 *   Returns the number of this Signal Station Kiosk (1-9)
 *
 *   Returns:
 *      String: "01" - "09"
 *
***********************************/
public function Signal_GetThisSignalStationNumber(): String
  {
	
	var sStation :String;		
	
	sStation = ExternalInterface.call( "Signal_GetThisSignalStationNumber" , "C" );
	
	return( sStation );
		
	} // End Signal_GetThisSignalStationNumber()

/**********************************
	*
	*  Signal_CheckForMessage()
	*
	*   For Messages received by normal Signals Station kiosks
	* 	Returns a message from another Signals Station kiosk.
	*		This should be polled regularly checking each of the other kiosks.
	*
	*   Signal Stations Should check 1-7, skipping it's own number.
	*
	*		Signal Station Displays should check 1-7
	*
	*   Paramater:
	*				iSource:Number  The source to check (1-9)
	*
	*   Returns:  
	
	*     String - Comma delimited "Message"
	*
	*			NULL If no message
	*
	*			For Normal Signal Stations the Message Is:
	*
	*			"01,165,1,C:\\Today\\165_altered_1.jpg,1,John,127,1"
	*					
	*			Destination Station "01" - "07"
	*			ID of the recipient,
	*			ring tone #, 
	*			image path, 
	*			version number,
	*			guest name of the sender,
	*     color of the sender
	*			1 if watermarked, 0 if not
	*
	*			For Signal Station DISPLAY:
	*			"01,C:\\Today\\165_altered_1.jpg"
	*			Intedded Recipient "08" or "09",
	*			Path
	*
	***********************************/
	public  function  Signal_CheckForMessage( iSource:Number ): String
		{
			
    var sMessage:String;		
		
		sMessage = ExternalInterface.call( "Signal_CheckForMessage" , iSource );
		
		return( sMessage );
		
		} //  Signal_CheckForMessage()					

 /**********************************
	*
	*  Signal_SendMessage()
	*
	* 	Sends a message to another signal station kiosk
	*
	*   Used for ending To A Normal Signal Stations Kiosk #1-7
	*
	*		sMessage:String  "01,165,1,C:\\Today\\165_altered_1.jpg,1,John,127,1"
	*			Destination Station "01" - "07"
	*			ID of the recipient,
	*			ring tone #, 
	*			image path, 
	*			version number,
	*			guest name of the sender,
	*     color of the sender
	*			1 if watermarked, 0 if not
	*
	*   Returns:
	*  
	***********************************/
	public  function Signal_SendMessage( sMessage:String )
		{
		
		ExternalInterface.call( "Signal_SendMessage" , sMessage );
		
		return;		
		
		} // Signal_SendMessage()		

 /**********************************
	*
	*  Signal_SendMessageToDisplay()
	*
	* 	Sends a message to one of the Signal Stations DISPLAY kiosks
	*
	*   The message will be sent to the specified 
	*    Signal Stations DISPLAY computer 1 or 2
	*
	*		Flash Host will get the path to the main Altered Image for 
	*     the current user and assemble a message with that information.
	*   The message sent to the Display will be the destination station,
	*     followed by the path to the image.
	*
	*   Parameters:
	*			sStation:Number 1 or 2
	*
	*   Returns:
	*  
	***********************************/
	public  function Signal_SendMessageToDisplay( iStation:Number )
		{
		
		ExternalInterface.call( "Signal_SendMessageToDisplay" , iStation );
		
		return;		
		
		} // Signal_SendMessageToDisplay()		
		
		



		
	//
	// ROBOTS
	//

	/**********************************
	*
	*  Robot_SetColorBand()
	*
	* 	Sends a value to the controller to set the robot perimeter lights
	*
	***********************************/
	public  function  Robot_SetColorBand( iLightValue:Number ):void 
		{
		
		ExternalInterface.call( "Robot_SetColorBand" , iLightValue );
		
		} //  Robot_SetColorBand()		
		
	//
	// DANCE & ANNIMATION STATION
	//
	/**********************************
	*
	*  Transparency_On()
	*
	* 	Turns on transparency
	*
	***********************************/
	public function  Transparency_On():void 
		{
			
			trace("ON");
		
		  ExternalInterface.call( "Transparency_On" , "C" );
		
		} //  Transparency_On()		
	
	/**********************************
	*
	*  Transparency_Off()
	*
	* 	Turns off transparency
	*
	***********************************/
	public function  Transparency_Off():void 
		{
		
			trace("Off");
			
		ExternalInterface.call( "Transparency_Off" , "C" );
		
		} //  Transparency_Off()					
		
	/**********************************
	*
	*  Surgery_SendKeyToCommPort()
	*
	* 	Sends an ASCII character out the COMM port (used for TouchEngine)
	*
	***********************************/
	public  function  Surgery_SendKeyToCommPort( szKey:String ) 
		{
		
		ExternalInterface.call( "Surgery_SendToPort" , szKey );
		
		} //  Surgery_SendKeyToCommPort()					

	/**********************************
	*
	*  Surgery_SetHapticMode()
	*
	* 	Sends a number of the mode to the Falcon Haptic DLL
	*
	***********************************/
	public  function  Surgery_SetHapticMode( iMode:Number ) 
		{
		
		ExternalInterface.call( "Surgery_SetHapticMode" , iMode );
		
		} //  Surgery_SetHapticMode()					

	/**********************************
	*
	*  Surgery_GetXYZPos()
	*
	* 	Gets an X,Y,Z position from Falcon Haptic DLL
	*
	***********************************/
	public  function  Surgery_GetXYZPos():String
		{
		var sXYZ:String;

		sXYZ = String( ExternalInterface.call( "Surgery_GetXYZPos" ) );
		
		return( sXYZ );		
		
		} //  Surgery_GetXYZPos()					
	
	/**********************************
	*
	*  Surgery_GetForce()
	*
	* 	Gets the current "Force" from the haptic and returns it
	*     as a comma delimited string of 3 values
	*
	***********************************/
	public  function  Surgery_GetForce():String
		{
		var sForce:String;

		sForce = String( ExternalInterface.call( "Surgery_GetForce" ) );
		
		return( sForce );		
		
		} //  Surgery_GetForce()					
	
	/**********************************
	*
	*  Surgery_GetStatus()
	*
	* 	Gets the current "Status" from the haptic and returns it
	*     as a comma delimited string of 7 values
	*
	***********************************/
	public  function  Surgery_GetStatus():String
		{
		var sStatus:String;

		sStatus = String( ExternalInterface.call( "Surgery_GetStatus" ) );
		
		return( sStatus );		
		
		} //  Surgery_GetStatus()			
		
	/**********************************
	*
	*  Animation_Reset()
	*
	* 	Starts a new character animation session.
	*		Resets variables
	*
	***********************************/
	public  function  Animation_Reset() :void
		{
		
		ExternalInterface.call( "Animation_Reset" , "C" );
		
		} //  Animation_Reset()					

	/**********************************
	*
	*  Animation_StartCharacterSection()
	*
	* 	Starts the character animation section.
	*			Loads the character file
	*			Loads and initializes variables
	*     and more.
	*
	*  sCharacterName:String
	*			Name of character we will animate:
	*				Furbolg" || "Talwyn" || "Lani" || "Custom"
	*
	***********************************/
	public  function  Animation_StartCharacterSection( sCharacterName:String ) :void
		{
		
		ExternalInterface.call( "Animation_StartCharacterSection" , sCharacterName );
		
		} //  Animation_StartCharacterSection()					

	/**********************************
	*
	*  Animation_StartEnvironmentSection()
	*
	* 	Starts the environemnt animation section.
	*			Loads the environemnt file
	*			Loads and initializes variables
	*     and more.
	*
	*  sEnvironmentName:String
	*			Name of environment we will animate:
	*				"Island" || "Snowhill" || "Bedroom"
	*
	***********************************/
	public  function  Animation_StartEnvironmentSection( sEnvironmentName:String ) :void
		{
		
		ExternalInterface.call( "Animation_StartEnvironmentSection" , sEnvironmentName );

		AddToLog(	"Start Animation." );
		
		} //  Animation_StartEnvironmentSection()					

	/**********************************
	*
	*  Animation_CharacterLoading()
	*
	* 	Returns "1" If character is still loading
	*           "0" When done
	*
	***********************************/
	public  function  Animation_CharacterLoading():String
		{
		var sStatus:String;

		sStatus = String( ExternalInterface.call( "Animation_CharacterLoading" ) );
		
//		AddToLog( "Check Load: " + sStatus );
		
		return( sStatus );		
		
		} //  Animation_CharacterLoading()			
		
	/**********************************
	*
	*  Animation_HideViewerWindow()
	*
	* 	Hides the Motion Builder "Viewer" window
	*		Call this before turning off transparency
	*
	***********************************/
	public  function  Animation_HideViewerWindow() :void
		{
		
		ExternalInterface.call( "Animation_HideViewerWindow" , "C" );
		
		} //  Animation_HideViewerWindow()					

	/**********************************
	*
	*  Animation_ShowViewerWindow()
	*
	* 	Shows the Motion Builder "Viewer" window
	*		Call this after turning on transparency
	*
	***********************************/
	public  function  Animation_ShowViewerWindow():void 
		{
		
		ExternalInterface.call( "Animation_ShowViewerWindow" , "C" );
		
		} //  Animation_ShowViewerWindow()					
		
	/**********************************
	*
	*  Animation_SetMBWindowPositionAndSize()
	*
	* 	Sets the Motion Builder Window to a specific position and size
	*   Size and position are held in FlashHost.ini
	*
	*    iMode = 1 then use:  -- This is for portrait window for Characters Manipulation
	*				[MOTION_BUILDER]
	*					MbWindowX_1=778
	*					MbWindowY_1=197
  *					MbWindowWidth_1=681
  *					MbWindowHeight_1=831			
	*    iMode = 2 then use:
	*				[MOTION_BUILDER]
	*					MbWindowX_2=
	*					MbWindowY_2=
  *					MbWindowWidth_2=
  *					MbWindowHeight_2=					
	*
	*    And so on.	
	*
	***********************************/
	public  function  Animation_SetMBWindowPositionAndSize( iMode:Number ):void 
		{
		
		ExternalInterface.call( "Animation_SetMBWindowPositionAndSize" , iMode );
		
		} //  Animation_SetMBWindowPositionAndSize()					

	/**********************************
	*
	*  Animation_MoveCharacter()
	*
	* 	Moves the specified part of the currently loaded and selected character
	*     the specified amount
	*		Each part has it's own minmum and maximum distances.
	*
	*   Parameters:
	*			sBodyPart:String  The part to move
	*			iMove:Number The amount to move
	*
	*			szBodyPart =       szMove=
	*          HeadSide       -100 to +100
	*          HeadBack       -100 to +100
	*          ChestSide      -100 to +100  
	*          ChestBack      -100 to +100
	*          Hips           -100 to +100
	*          LeftArm        -100 to +250
	*          RightArm       -100 to +250
	*
	*					 MouthOpen         0 to +100
	*          LeftMouth      -100 to +100
	*          RightMouth     -100 to +100
	*					 EyeCorners     -100 to +100
	*					 LeftBrow       -100 to +100
	*					 RightBrow      -100 to +100
	*
	***********************************/
	public  function  Animation_MoveCharacter( sBodyPart:String, iMove:Number ):void
		{
		
		ExternalInterface.call( "Animation_MoveCharacter" , sBodyPart, iMove );
		
		} //  Animation_MoveCharacter()				

	/**********************************
	*
	*  Animation_SetCamera()
	*
	* 	Changes the view displayed in the Motion Builder window
	*
	*		Parameters:
	*			sView:String  The view, either "FACE" or "BODY"
	*		
	*
	***********************************/
	public  function  Animation_SetCamera( sView:String ):void 
		{
		
		ExternalInterface.call( "Animation_SetCamera" , sView );
		
		} //  Animation_SetCamera()					
		
	/**********************************
	*
	*  Animation_Rotate()
	*
	* 	Rotates the current image
	*
	*		Parameters:
	*			sAngle:String  The position "-90" to "+90"
	*		
	*
	***********************************/
	public  function  Animation_Rotate( sAngle:String ):void 
		{
		
		ExternalInterface.call( "Animation_Rotate" , sAngle );
		
		} //  Animation_Rotate()					

	/**********************************
	*
	*  Animation_SetKeyframe()
	*
	* 	Sets the data from current active frame 
  *      as Keyframe data
	* 	Sets the frame we are working on 
	*
	*   Parameters:
	*				iFrame: Number  The frame 1 or 2
	*
	***********************************/
	public  function  Animation_SetKeyframe( iFrame: Number ):void 
		{
		
		ExternalInterface.call( "Animation_SetKeyframe" , iFrame );
		
		} //  Animation_SetKeyframe()					

	/**********************************
	*
	*  Animation_Playback()
	*
	* 	Controls animation playback
  *     
	*   Parameters:
	*				sAction:String
	*					"Play"
	*					"Stop"
	*					"StepBack"
	*					"StepForward"
	*					"MoveStart"
	*					"MoveEnd"
	*
	***********************************/
	public  function  Animation_Playback( sAction:String ):void 
		{
		
		ExternalInterface.call( "Animation_Playback" , sAction );
		
		} //  Animation_Playback()					
		
	/**********************************
	*
	*  Animation_RenderFile()
	*
	* 	Renders the current authored animation out to a file
	*    depending on .INI setting this could be a quicktime
	*		 or a jpg
  *     
	*   At the same time we will save the filename of this file to 
	*		 the database.
	*
	*   Parameters:
	*
	***********************************/
	public  function  Animation_RenderFile():void 
		{
		
		ExternalInterface.call( "Animation_RenderFile" );
		
		} //  Animation_RenderFile()					
		
	/**********************************
	*
	*  Animation_CheckRender()
	*
	* 	Returns "1" If Render is still running
	*           "0" When done
	*
	***********************************/
	public  function  Animation_CheckRender():String
		{
		var sStatus:String;

		sStatus = String( ExternalInterface.call( "Animation_CheckRender" ) );
		
		return( sStatus );		
		
		} //  Animation_CheckRender()			
		
	/**********************************
	*
	*  Animation_StopRefresh()
	*
	*   Stops Motion Builder from refreshing the screen (and animating)
	*      so that objects can be placed on top of the Motion Builder Window.
	*
	*		Parametrs: None
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_StopRefresh():void
		{

		ExternalInterface.call( "Animation_StopRefresh" );
		
		return;		
		
		} //  Animation_StopRefresh()			

	/**********************************
	*
	*  Animation_StartRefresh()
	*
	*   Starts Motion Builder refresh animation and screen update.
	*      Nothing can be on top of the Motion Builder Window.
	*
	*		Parametrs: None
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_StartRefresh():void
		{

		ExternalInterface.call( "Animation_StartRefresh" );
		
		return;		
		
		} //  Animation_StartRefresh()			
		
	/**********************************
	*
	*  Animation_EnvironmentSelectObject()
	*
	*   Selects the environment object that will be manipulated by the guest
	*
	*		Parametrs: iObject:Number
	*									The selected object 1-10
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentSelectObject( iObject:Number ):void
		{

		ExternalInterface.call( "Animation_EnvironmentSelectObject", iObject );
		
		return;		
		
		} //  Animation_EnvironmentSelectObject()			

	/**********************************
	*
	*  Animation_EnvironmentRotateCameraView()
	*
	*   Rotates the camera view while the objects are manipulated
	*
	*		Parametrs: sPosition:String
	*									The camera position "-10" to "10"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentRotateCameraView( sPosition:String ):void
		{

		ExternalInterface.call( "Animation_EnvironmentRotateCameraView", sPosition );
		
		return;		
		
		} //  Animation_EnvironmentRotateCameraView()			
		
	/**********************************
	*
	*  Animation_EnvironmentScaleObject()
	*
	*   Scales the currently selected environment object
	*
	*		Parametrs: sVector:String
	*									The vector that is changing "X" or "Y" or "Z"
	*              sPosition:String
	*									The new position "1" to "100"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentScaleObject( sVector:String, sPosition:String ):void
		{

		ExternalInterface.call( "Animation_EnvironmentScaleObject", sVector, sPosition );
		
		return;		
		
		} //  Animation_EnvironmentScaleObject()			
		
	/**********************************
	*
	*  Animation_EnvironmentRotateObject()
	*
	*   Scales the currently selected environment object
	*
	*		Parametrs: sVector:String
	*									The vector that is changing "X" or "Y" or "Z"
	*              sPosition:String
	*									The new position "0" to "100"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentRotateObject( sVector:String, sPosition:String ):void
		{

		ExternalInterface.call( "Animation_EnvironmentRotateObject", sVector, sPosition );
		
		return;		
		
		} //  Animation_EnvironmentRotateObject()			
		
	/**********************************
	*
	*  Animation_EnvironmentTranslateObject()
	*
	*   Translates the currently selected environment object
	*
	*		Parametrs: sVector:String
	*									The vector that is changing "X" or "Y" or "Z"
	*              sPosition:String
	*									The new position "0" to "100"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentTranslateObject( sVector:String, sPosition:String ):void
		{

		ExternalInterface.call( "Animation_EnvironmentTranslateObject", sVector, sPosition );
		
		return;		
		
		} //  Animation_EnvironmentTranslateObject()			
	
	/**********************************
	*
	*  Animation_EnvironmentSelectLightEffect()
	*
	*   Selects a lighting effect
	*
	*		Parametrs: sEffect:String
	*									The effect "0" to "5"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentSelectLightEffect( sEffect:String ):void
		{

		ExternalInterface.call( "Animation_EnvironmentSelectLightEffect", sEffect );
		
		return;		
		
		} //  Animation_EnvironmentSelectLightEffect()			

	/**********************************
	*
	*  Animation_StartEnvironmentAnimation()
	*
	*   Starts the animation moving so they can see the lighting and effects
	*
	*		Parametrs: None
	*									
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_StartEnvironmentAnimation():void
		{

		ExternalInterface.call( "Animation_StartEnvironmentAnimation" );
		
		return;		
		
		} //  Animation_StartEnvironmentAnimation()			

	/**********************************
	*
	*  Animation_SetVisualEffectSize()
	*
	*   Sets the size of the specified visual effect
	*
	*		Parametrs: sEffect:String	The effect "1" to "3"
	*							 sSize:String "0" to "100"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_SetVisualEffectSize( sEffect:String, sSize:String ):void
		{

		ExternalInterface.call( "Animation_SetVisualEffectSize", sEffect, sSize );
		
		return;		
		
		} //  Animation_SetVisualEffectSize()			

	/**********************************
	*
	*  Animation_SetVisualEffectSpeed()
	*
	*   Sets the size of the specified visual effect
	*
	*		Parametrs: sEffect:String	The effect "1" to "3"
	*							 sSize:String "0" to "1000"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_SetVisualEffectSpeed( sEffect:String, sSpeed:String ):void
		{

		ExternalInterface.call( "Animation_SetVisualEffectSpeed", sEffect, sSpeed );
		
		return;		
		
		} //  Animation_SetVisualEffectSpeed()			

	/**********************************
	*
	*  Animation_SetVisualEffectQuanity()
	*
	*   Sets the size of the specified visual effect
	*
	*		Parametrs: sEffect:String	The effect "1" to "3"
	*							 sSize:String "0" to "2000"
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_SetVisualEffectQuanity( sEffect:String, sQuanity:String ):void
		{

		ExternalInterface.call( "Animation_SetVisualEffectQuanity", sEffect, sQuanity );
		
		return;		
		
		} //  Animation_SetVisualEffectQuanity()			

	/**********************************
	*
	*  Animation_ShowVisualEffect()
	*
	*   Shows the specified visual effect
	*
	*		Parametrs: sEffect:String	The effect "1" to "3"
	*							 sOnOff:String "0" off  "1" on							 
	*
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_ShowVisualEffect( sEffect:String, sOnOff:String ):void
		{

		ExternalInterface.call( "Animation_ShowVisualEffect", sEffect, sOnOff );
		
		return;		
		
		} //  Animation_ShowVisualEffect()	
		
	/**********************************
	*
	*  Animation_StartCustomCharacter()
	*
	*   Starts the custon character section
	*
	*   Poll Animation_CharacterLoading() to determine when this action completes. 
	*
	*		Parametrs: None
	*									
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_StartCustomCharacter():void
		{

		ExternalInterface.call( "Animation_StartCustomCharacter" );
		
		return;		
		
		} //  Animation_StartCustomCharacter()			
		
	/**********************************
	*
	*  Animation_CustomCharacterBuild()
	*
	* 	Changes parts of the custom character as you watch them
	*   
	*		Each part has it's own minmum and maximum distances.
	*
	*   Parameters:
	*			sBodyPart:String  The part to move
	*			iValue:Number The amount to move
	*
	*			szBodyPart =       szMove=
	*          ArmUp         0 to +100
	*          ArmLo         0 to +100
	*          Torso         0 to +100  
	*          LegUp         0 to +100
	*          LegLo         0 to +100
	*          Color1        0 to +100
	*          Color2        0 to +100
	*
	*					 Face          0 to +100
	*          Nose          0 to +100
	*          Hair          0 to +100
	*					 HairColor     0 to +100
	*					 Skin          0 to 20
	*
	***********************************/
	public  function  Animation_CustomCharacterBuild( sBodyPart:String, iValue:Number ):void
		{
		
		ExternalInterface.call( "Animation_CustomCharacterBuild" , sBodyPart, iValue );
		
		} //  Animation_CustomCharacterBuild()				

	/**********************************
	*
	*  Animation_CustomMoveCharacter()
	*
	* 	Moves the specified part of the CUSTOM character
	*     the specified amount
	*		Each part has it's own minmum and maximum distances.
	*
	*   Parameters:
	*			sBodyPart:String  The part to move
	*			iMove:Number The amount to move
	*
	*			szBodyPart =       szMove=
	*          HeadSide       -100 to +100
	*          HeadBack       -100 to +100
	*          ChestSide      -100 to +100  
	*          ChestBack      -100 to +100
	*          Hips           -100 to +100
	*          LeftArm        -100 to +200
	*          RightArm       -100 to +200
	*
	*					 MouthOpen         0 to +100
	*					 EyeCorners     -100 to +100
	*					 LeftBrow       -100 to +100
	*					 RightBrow      -100 to +100
	*
	***********************************/
	public  function  Animation_CustomMoveCharacter( sBodyPart:String, iMove:Number ):void
		{
		
		ExternalInterface.call( "Animation_CustomMoveCharacter" , sBodyPart, iMove );
		
		} //  Animation_CustomMoveCharacter()	
		
	/**********************************
	*
	*  Animation_CustomSetCamera()
	*
	* 	Changes the view displayed in the Motion Builder window
	*
	*		Parameters:
	*			sView:String  The view, either "FACE" or "BODY"
	*		
	*
	***********************************/
	public  function  Animation_CustomSetCamera( sView:String ):void 
		{
		
		ExternalInterface.call( "Animation_CustomSetCamera" , sView );
		
		} //  Animation_CustomSetCamera()					
		
	/**********************************
	*
	*  Animation_CustomRotate()
	*
	* 	Rotates the current image
	*
	*		Parameters:
	*			sAngle:String  The position "-90" to "+90"
	*		
	*
	***********************************/
	public  function  Animation_CustomRotate( sAngle:String ):void 
		{
		
		ExternalInterface.call( "Animation_CustomRotate" , sAngle );
		
		} //  Animation_CustomRotate()					

	/**********************************
	*
	*  Animation_CustomSetKeyframe()
	*
	* 	Sets the data from current active frame 
  *      as Keyframe data
	* 	Sets the frame we are working on 
	*
	*   Parameters:
	*				iFrame: Number  The frame 1 or 2
	*
	***********************************/
	public  function  Animation_CustomSetKeyframe( iFrame: Number ):void 
		{
		
		ExternalInterface.call( "Animation_CustomSetKeyframe" , iFrame );
		
		} //  Animation_CustomSetKeyframe()					

	/**********************************
	*
	*  Animation_CustomPlayback()
	*
	* 	Controls animation playback
  *     
	*   Parameters:
	*				sAction:String
	*					"Play"
	*					"Stop"
	*					"StepBack"
	*					"StepForward"
	*					"MoveStart"
	*					"MoveEnd"
	*
	***********************************/
	public  function  Animation_CustomPlayback( sAction:String ):void 
		{
		
		ExternalInterface.call( "Animation_CustomPlayback" , sAction );
		
		} //  Animation_CustomPlayback()					
		
	/**********************************
	*
	*  Animation_CharacterResetSliders()
	*
	*   Resets to default the movements used in the "normal" character mode
	*
	*		Parametrs: None
	*									
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_CharacterResetSliders():void
		{

		ExternalInterface.call( "Animation_CharacterResetSliders" );
		
		return;		
		
		} //  Animation_CharacterResetSliders()			
		
	/**********************************
	*
	*  Animation_CustomResetSliders()
	*
	*   Resets to default the movements used in the "Custom" "Build" character mode
	*
	*		Parametrs: None
	*									
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_CustomResetSliders():void
		{

		ExternalInterface.call( "Animation_CustomResetSliders" );
		
		return;		
		
		} //  Animation_CustomResetSliders()			
		
	/**********************************
	*
	*  Animation_CustomResetPostureSliders()
	*
	*   Resets to default the movements used in the "Custom" "Posture" character mode
	*
	*		Parametrs: None
	*									
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_CustomResetPostureSliders():void
		{

		ExternalInterface.call( "Animation_CustomResetPostureSliders" );
		
		return;		
		
		} //  Animation_CustomResetPostureSliders()			
		
	/**********************************
	*
	*  Animation_EnvironmentResetSliders()
	*
	*   Resets to default the movements used in the Environment mode
	*
	*		Parametrs: None
	*									
	* 	Returns: None
	*
	***********************************/
	public  function  Animation_EnvironmentResetSliders():void
		{

		ExternalInterface.call( "Animation_EnvironmentResetSliders" );
		
		return;		
		
		} //  Animation_EnvironmentResetSliders()			
		
	/**********************************
	*
	*  SwtlMap_GetActiveGuests()
	*
	* 	Returns list of all currently logged in guests
	*
	*   Returns:
	*       Station ID, Name, Color, Station ID, Name, Color...
	*				Null if error
	*
	***********************************/
	public  function  SwtlMap_GetActiveGuests(): String
		{
		
		var sList:String;
		
		sList = String( ExternalInterface.call( "SwtlMap_GetActiveGuests" , "C" ) );
		
		return( sList );
		
		} //  SwtlMap_GetActiveGuests()					


				
} // End of class cHoster
} //end of package